import Vue from 'vue';
import Router from 'vue-router';
import index from '../page/index';                           //首页
import userCenter from '../page/userCenter';                 //用户中心
import recommend from '../page/recommend';                   //推荐
import detail from '../page/detail';                         //免费推荐详情
import login from '../page/login';                           //登录
import registery from '../page/registery';                   //注册
import expert from '../page/expert';                         //专家
import expertrecommend from '../page/expertrecommend';       //专家推荐
import recommendmes from '../page/recommendmes';             //专家信息
import jifen from '../page/jifen';            				 //积分记录
import gourecommend from '../page/gourecommend';  			 //已购推荐
import help from '../page/help';  				             //帮助中心
import payment from '../page/payment';   				     //二串一
import hong from '../page/hong';   				     		 //当红
import gamelist from '../page/gamelist';   				     //列表



Vue.use(Router);

export default new Router({
	mode: 'hash',
	base: '/',
	routes: [
		{
		path: '/',
		component: index,
		name: 'index'
		}, 
		{
			path: '/index',
			component: index,
			name: 'index1'
		},
		{
			path: '/userCenter',
			component: userCenter,
			name: 'userCenter'
		},
		{
			path: '/recommend',
			component: recommend,
			name: 'recommend'
		},
		{
			path: '/detail',
			component: detail,
			name: 'detail'
		},
		{
			path: '/login',
			component: login,
			name: 'login'
		},
		{
			path: '/registery',
			component: registery,
			name: 'registery'
		},
	    {
			path: '/expert',
			component: expert,
			name: 'expert'
		}, {
			path: '/expertrecommend',
			component: expertrecommend,
			name: 'expertrecommend'
		}, {
			path: '/recommendmes',
			component: recommendmes,
			name: 'recommendmes'
		}, {
			path: '/jifen',
			component: jifen,
			name: 'jifen'
		}, {
			path: '/gourecommend',
			component: gourecommend,
			name: 'gourecommend'
		}, {
			path: '/help',
			component: help,
			name: 'help'
		}, {
			path: '/payment',
			component: payment,
			name: 'payment'
		}, {
			path: '/hong',
			component: hong,
			name: 'hong'
		}, {
			path: '/gamelist',
			component: gamelist,
			name: 'gamelist'
		}
],
	scrollBehavior(to, from, savedPosition) {
		if(savedPosition) {
			return savedPosition;
		} else {
			document.scrollingElement.scrollTop = 0;
		}
	}
});